const namespace = 'GS.'

const local = {
    set(key, data) {
        window.localStorage.setItem(namespace + key, JSON.stringify(data))
    },
    get(key) {
        const data = window.localStorage.getItem(namespace + key)
        return JSON.parse(data)
    },
    remove(key) {
        window.localStorage.removeItem(namespace + key)
    }
}
const session = {
    set(key, data) {
        window.sessionStorage.setItem(namespace + key, JSON.stringify(data))
    },
    get(key) {
        const data = window.sessionStorage.getItem(namespace + key) || '[]'
        return JSON.parse(data)
    },
    remove(key) {
        window.sessionStorage.removeItem(namespace + key)
    }
}

export {
    local,
    session
}